import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/mes-admin/productpackingconfig/page',
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  });
};

export const getDetail = (id) => {
  return request({
    url: '/api/mes-admin/productpackingconfig/detail',
    method: 'get',
    params: {
      id
    }
  });
};

export const remove = (ids) => {
  return request({
    url: '/api/mes-admin/productpackingconfig/remove',
    method: 'post',
    params: {
      ids
    }
  });
};

export const add = (row) => {
  return request({
    url: '/api/mes-admin/productpackingconfig/submit',
    method: 'post',
    data: row
  });
};

export const update = (row) => {
  return request({
    url: '/api/mes-admin/productpackingconfig/submit',
    method: 'post',
    data: row
  });
};

export const getPackingconfigDetail = (productPackingConfigId, parentId) => {
  return request({
    url: '/api/mes-admin/productpackingconfig/detail/lazy-list',
    method: 'get',
    params: {
      productPackingConfigId,
      parentId
    }
  });
};

export const getPackingconfigDetailByPartMasterId = (partMasterId) => {
  return request({
    url: '/api/mes-admin/productpackingconfig/detail/lazy-list',
    method: 'get',
    params: {
      partMasterId
    }
  });
};

export const addPackingconfigDetail = (row) => {
  return request({
    url: '/api/mes-admin/productpackingconfig/detail/submit',
    method: 'post',
    data: row
  });
};

export const removePackingconfigDetail = (ids) => {
  return request({
    url: '/api/mes-admin/productpackingconfig/detail/remove',
    method: 'post',
    params: {
      ids
    }
  });
};

export const getDetailPackingconfigDetail = (id) => {
  return request({
    url: '/api/mes-admin/productpackingconfig/detail/info',
    method: 'get',
    params: {
      id
    }
  });
};
